package com.inspectortime.domain.util;

import java.util.Comparator;

import com.inspectortime.domain.Inspection;

/**
 * For sorting Inspections.  Compares inspections by inspectionTime
 * 
 * @author bones
 *
 */
public class InspectionDateComparator implements Comparator {

	public int compare(Object arg1, Object arg2) {
		
		Inspection inspection1 = (Inspection) arg1;
		Inspection inspection2 = (Inspection) arg2;
		
		if (inspection1.getInspectionTime().after(inspection2.getInspectionTime())) {
			return 1;
		}
		
		if (inspection1.getInspectionTime().before(inspection2.getInspectionTime())) {
			return -1;
		}
		
		return 0;
		
	}
	
	

}
